//hunter.txt - Same as talknpc except that, if it is ever hostile, will immediately 
//hunt down the pc and attack.
// Memory Cells:
//   Cell 0 - If 0, default behavior. If 1, it doesnt fidget.
//   Cell 1 - Number of state when talked to. Plays default text if 0.
//   Cell 2,3 -  Stuff done flag. If both 0, nothing. Otherwise when this is killed, set to 1.

begincreaturescript;

variables;

short i,target;

body;

beginstate INIT_STATE;
	set_name(ME,"Thrasher");
	set_level(ME,3);
	change_max_health(ME,200);
	set_strategy(ME,10);
	
	if (gf(0,1) > 0)
		erase_char(ME);
	break;

beginstate DEAD_STATE;
	if (gf(1,22) == 0)
		begin_talk_mode(69);
	
break;

beginstate START_STATE; 
	if (gf(0,11) == 0)
		end();

	if (gf(0,12) == 1) {
		sf(0,12,2);
		set_attitude(ME,4);
		award_party_xp(50,1);
		begin_talk_mode(69);
		}
		
	// if I have a target for some reason, go attack it
	if (target_ok()) {
		if (dist_to_char(get_target()) <= 16)
			set_state(3);
			else set_foe_target(ME,-1);
		}
	
	if (get_foe_target(ME,8,0)) {
		do_attack();
		set_state(3);
		}
	if (who_shot_me() >= 0) {
		set_foe_target(ME,who_shot_me());
		do_attack();
		set_state(3);
		}


	if ((get_attitude(ME) >= 10) && (dist_to_pc() <= 40) && (gf(0,12) == 0)) {
		maintain_dist_to_char(ME,pc_num(),2);
		}
		else fidget(ME,20);
		
	if (am_i_doing_action() == FALSE)
		end_combat_turn();

break;

beginstate 3; // attacking
	if (gf(0,12) == 1) {
		sf(0,12,2);
		set_attitude(ME,4);
		award_party_xp(50,1);
		begin_talk_mode(69);
		}
		
	if (target_ok() == FALSE)
		set_state(START_STATE);

	if ((get_target() != 8) && (can_see_char(8)))
		set_foe_target(ME,8);	
	if ((gf(0,2) > 0) && (gf(0,12) == 0) && (get_ran(1,0,100) < 50))
		print_str_color("Mehken shouts, 'Hit it with fire! That will scare it!'",2);
	
	do_attack();
break;

beginstate TALKING_STATE;
	print_str("Talking: Thrasher shies away from you. It doesn't want to be hurt again.");
	print_str("  You try to speak with it, but most battle alphas can't talk.");
break;